<template>
  <div>
    <BasicTable @register="registerTable" />
  </div>
</template>
<script lang="ts">
  export default defineComponent({
    name: 'ViewsProjInfoPmZoneallocationHistoryList',
  });
</script>
<script lang="ts" setup>
  import { defineComponent, watch } from 'vue';
  import { useI18n } from '/@/hooks/web/useI18n';
  import { BasicTable, BasicColumn, useTable } from '/@/components/Table';
  import { pmZoneallocationHistoryListData } from '/@/api/proj/info/pmZoneallocationHistory';

  const { t } = useI18n('proj.info.pmZoneallocationHistory');

  const props = defineProps({
    projectno: { type: String, default: '' },
  });

  watch(
    () => props.projectno,
    () => {
      reload();
    },
  );

  const tableColumns: BasicColumn[] = [
    {
      title: t('更改时间'),
      dataIndex: 'hisCreateTime',
      key: 'a.hisCreateTime',
      sorter: true,
      width: 150,
      align: 'center',
    },
    {
      title: t('承包商'),
      dataIndex: 'constructionunit',
      key: 'a.constructionunit',
      sorter: true,
      width: 200,
      align: 'left',
    },
    {
      title: t('监理'),
      dataIndex: 'supervision',
      key: 'a.supervision',
      sorter: true,
      width: 230,
      align: 'left',
    },
    {
      title: t('项目负责人'),
      dataIndex: 'projectleader',
      key: 'a.projectleader',
      sorter: true,
      width: 110,
      align: 'left',
    },
    {
      title: t('技术责任人'),
      dataIndex: 'techleader',
      key: 'a.techleader',
      sorter: true,
      width: 110,
      align: 'left',
    },
    {
      title: t('安全责任人'),
      dataIndex: 'securityleader',
      key: 'a.securityleader',
      sorter: true,
      width: 110,
      align: 'left',
    },
    {
      title: t('材料负责人'),
      dataIndex: 'materialowner',
      key: 'a.materialowner',
      sorter: true,
      width: 110,
      align: 'left',
    },
    {
      title: t('资料负责人'),
      dataIndex: 'dataowner',
      key: 'a.dataowner',
      sorter: true,
      width: 110,
      align: 'left',
    },
    {
      title: t('工期'),
      dataIndex: 'plannedduration',
      key: 'a.plannedduration',
      sorter: true,
      width: 60,
      align: 'left',
    },
  ];

  const [registerTable, { reload }] = useTable({
    api: pmZoneallocationHistoryListData,
    beforeFetch: (params) => {
      params.projectcode = props.projectno;
      return params;
    },
    columns: tableColumns,
    showTableSetting: true,
    useSearchForm: false,
    canResize: true,
  });
</script>

<style lang="less" scoped></style>
